import Mock from 'mockjs'

const BASE_URL = ''

export default [

	{
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/getOrganizationList`, // 获取组织机构列表
		type: 'post',
		response: config => {
			const {
				page,
				limit,
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@guid',
					departmentName: '@ctitle',
					higherDepartment: '@ctitle'
				}))
			}
			const organizationList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					organizationList,
					total: List.length
				}
			}
		}
	},
	{ //新增组织机构
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/insertOrganizationInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '新增成功'
			}
		}
	},
	{ //修改组织机构
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/updateOrganizationInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{ //删除组织机构
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/deleteOrganizationInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '删除成功'
			}
		}
	},
	{ //获取组织机构信息
		url: `${BASE_URL}/EnvironmentaldepartmentLst.asmx/getOrganizationInfo`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock({
					id: "@guid",
					departmentName: '@ctitle',
					higherDepartment: '@guid'
				})
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	},
	{
		url: `${BASE_URL}/PersonRoleLst.asmx/getRoleInfoList`, // 获取角色列表
		type: 'post',
		response: config => {
			const {
				page,
				limit,
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@guid',
					roleName: "@cname",
					"XMDaccount|1": ["是", "否"]
				}))
			}

			const roleList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					roleList,
					total: List.length
				}
			}
		}
	},
	{ //新增角色配置
		url: `${BASE_URL}/PersonRoleLst.asmx/insertRoleInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '新增成功'
			}
		}
	},
	{ //修改角色配置
		url: `${BASE_URL}/PersonRoleLst.asmx/updateRoleInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{ //删除角色配置
		url: `${BASE_URL}/PersonRoleLst.asmx/deleteRoleInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '删除成功'
			}
		}
	},
	{ //获取角色配置信息
		url: `${BASE_URL}/PersonRoleLst.asmx/getRoleInfo`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock({
					id: "@guid",
					roleName: "@cname",
					"XMDaccount|1": ["是", "否"]
				})
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	},
	{
		url: `${BASE_URL}/PersonLst.asmx/getAccountList`, // 获取账号列表
		type: 'post',
		response: config => {
			const {
				page,
				limit,
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@guid',
					userName: "@cname",
					"role|1": ["管理员", "普通人"],
					person: "@cname",
					enterprise: "@ctitle"
				}))
			}

			const accountList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					accountList,
					total: List.length
				}
			}
		}
	},
	{ //人员详情
		url: `${BASE_URL}/PersonLst.asmx/getAccountInfo`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock({
					id: "@guid",
					userName: "@cname",
					"role|1": ["管理员", "普通人"],
					person: "@cname",
					enterprise: "@ctitle"
				})
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	},
	{ //人员新增
		url: `${BASE_URL}/PersonLst.asmx/insertAccountInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '新增成功'
			}
		}
	},
	{ //人员编辑
		url: `${BASE_URL}/PersonLst.asmx/updateAccountInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{ //人员删除
		url: `${BASE_URL}/PersonLst.asmx/deleteAccountInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '删除成功'
			}
		}
	},
	{ //校验重复性
		url: `${BASE_URL}/PersonLst.asmx/checkUserName`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				data: '1',
				msg: ''
			}
		}
	},

	{ //所属企业
		url: `${BASE_URL}/PersonLst.asmx/getEnterpriseInfos`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock([{
					label: '企业名称',
					value: '企业id',
				}])
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	},
	{ //人员类型
		url: `${BASE_URL}/PersonLst.asmx/getPersonTypes`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock([{
					label: '企业名称',
					value: '企业id',
				}])
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	},
	{ //角色信息
		url: `${BASE_URL}/PersonLst.asmx/getPersonRoles`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock([{
					label: '企业名称',
					value: '企业id',
				}])
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	},
	{
		url: `${BASE_URL}/systemConfig.asmx/getParamInfoList`, // 获取参数信息列表
		type: 'post',
		response: config => {
			const {
				page,
				limit,
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@increment',
					statisticsTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					minute: "@integer(1, 3)",
					abnormalFactor: "@integer(1, 3)",
					superviseFactor: "@integer(1, 3)"
				}))
			}

			const paramInfoList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					paramInfoList,
					total: List.length
				}
			}
		}
	},
	{ //参数信息新增
		url: `${BASE_URL}/PersonLst.asmx/insertParamInfoList`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '新增成功'
			}
		}
	},
	{ //参数信息修改
		url: `${BASE_URL}/PersonLst.asmx/updateParamInfoList`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{ //参数信息删除
		url: `${BASE_URL}/PersonLst.asmx/deleteParamInfoList`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '删除成功'
			}
		}
	},
	{ //参数信息获取
		url: `${BASE_URL}/PersonLst.asmx/getParamInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '获取成功'
			}
		}
	},
	{
		url: `${BASE_URL}/SystemSetLst.asmx/getSystemSetInfo`, // 获取模板信息列表
		type: 'post',
		response: config => {
			const {
				page,
				limit,
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@increment',
					"alertType|1": ["出库报警", "入库报警", "电子围栏报警"],
					offAlertDiscribe: "@ctitle",
					alertDiscribe: "@ctitle",
				}))
			}

			const templateList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					templateList,
					total: List.length
				}
			}
		}
	},
	{ //参数信息修改
		url: `${BASE_URL}/SystemSetLst.asmx/updateSystemSetInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/getAbnormalSurveyList`, // 获取异常监测配置列表
		type: 'post',
		response: config => {
			const {
				page,
				limit,
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: '@guid',
					enterprise: "@ctitle",
					legalPerson: "@cname",
					alarmFactor: "@integer(1, 3)",
					"abnormalType|1": ["出库报警", "入库报警", "电子围栏报警"],
					chargeDepartment: "@ctitle",
					abnormalTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					abnormalTotalTime: "@integer(1, 10)"
				}))
			}

			const abnormalSurveyList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			return {
				code: 200,
				data: {
					abnormalSurveyList,
					total: List.length
				}
			}
		}
	},
	{ //新增异常监测配置
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/InsertAlarmInfoSetInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{ //修改异常监测配置
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/UpdateAlarmInfoSetInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{ //删除异常监测配置
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/DeleteAlarmInfoSetInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '删除成功'
			}
		}
	},
	{ //获取异常监测配置详情
		url: `${BASE_URL}/AlarmInfoSetLst.asmx/getAlarmInfoSetInfo`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock({
					id: "@guid",
					enterprise: "@ctitle",
					legalPerson: "@cname",
					alarmFactor: "@integer(1, 3)",
					"abnormalType|1": ["出库报警", "入库报警", "电子围栏报警"],
					chargeDepartment: "@ctitle",
					abnormalTime: "@datetime('yyyy-MM-dd A HH:mm:ss')",
					abnormalTotalTime: "@integer(1, 10)"
				})
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	},
	// 
	{ //获取因子
		url: `${BASE_URL}/SystemDictionary.asmx/getMonitorObject`,
		type: 'post',
		response: config => {
			let query = config.query,
				result = null;
			if (query.id) {
				result = Mock.mock([{
					label: '企业名称',
					value: '企业id',
				}])
			}
			return {
				code: 200,
				data: result,
				msg: '获取成功'
			}
		}
	}
]
